﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QuanLyHocPhi.Util
{
    public class KieuDuLieu
    {
        public static bool ChuyenSangDecimal(string text, ref decimal val)
        {
            try
            {
                val = decimal.Parse(text);
                return true;
            }
            catch (Exception ex)
            {
                val = 0;
                return false;
            }
        }

        public static int ChuyenSangsonguyen(string text,out int err)
        {
            try
            {
               int val = int.Parse(text);
               err = 1;
                return val;
            }
            catch (Exception ex)
            {
                //val = 0;
                err = 0;
                return 0;
            }
          
        }
        public static float Chuyensangsothuc(string text, out int err)
        {
           err = 0;
            try
            {
                float fl = float.Parse(text);
                return fl;
            }catch
            {
                err = 1;
                
                return 0;
            }
        }
    }

}